<?php


namespace Part18_MemoMode\Code1;

require_once '../../autoload.php';

$player = new GameRole();

// 初始化角色状态
$player->GetInitState();
$player->StateDisplay();

// 保存进度
$backup = new GameRole();
$backup->setVitality($player->getVitality());
$backup->setAttack($player->getAttack());
$backup->setDefense($player->getDefense());

// 大战boss
$player->Fight();
$player->StateDisplay();

// 恢复之前的状态
$player->setVitality($backup->getVitality());
$player->setAttack($backup->getAttack());
$player->setDefense($backup->getDefense());

$player->StateDisplay();